<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      >
    <h:head>
    </h:head>
    <h:body>
        <div class="reservation">
            <h2>Reservation</h2>
            <h:form>
                <p>
                    <h:outputText styleClass="#{reservationBean.styleMessage}" value="#{reservationBean.message}"/>
                </p>
                <p>                            
                    <h:outputLabel for="patientName">Patient Name: </h:outputLabel>
                    <h:message for="patientName" styleClass="error"/>
                    <h:inputText id="patientName" value="#{reservationBean.patientName}" required="true"
                                 requiredMessage="#{msgs.Reser_NameRequire}" validatorMessage="#{msgs.Reser_NameLeght}">
                        <f:validateLength minimum="3" maximum="30"/>                        
                    </h:inputText>
                </p>
                <p>                            
                    <h:outputLabel for="patientPhoneNumber">Patient PhoneNumber: </h:outputLabel>
                    <h:message for="patientPhoneNumber" styleClass="error"/>
                    <h:inputText id="patientPhoneNumber" value="#{reservationBean.patientPhoneNumber}"
                                 validatorMessage="#{msgs.Reser_PhoneInvalid}"
                                 >
                        <f:validateRegex pattern="^[0-9-]{10,12}$"/>                        
                    </h:inputText>
                </p>
                <p>                            
                    <h:outputLabel for="patientEmail">Patient Email: </h:outputLabel>
                    <h:message for="patientEmail" styleClass="error"/>
                    <h:inputText id="patientEmail" value="#{reservationBean.patientEmail}"
                                 validatorMessage="#{msgs.Reser_Email}"
                                 >
                        <f:validateRegex pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]"/>
                    </h:inputText>
                </p>
                <p>                            
                    <h:outputLabel for="reservationTime">Reservation Time(yyyy-MM-dd): </h:outputLabel>
                    <h:message for="reservationTime" styleClass="error"/>
                    <h:inputText id="reservationTime" value="#{reservationBean.reservationTime}" converterMessage="#{msgs.Reser_DateTime}">
                        <f:convertDateTime pattern="yyyy-MM-dd"/>
                    </h:inputText>
                </p>
                <p>                            
                    <h:outputLabel for="require">Require: </h:outputLabel>
                    <h:inputTextarea id="require" value="#{reservationBean.require}"/>
                </p>
                <p>
                    <h:commandButton value="Reservation" action="#{reservationBean.addReservation()}"/>
                </p>
            </h:form>
        </div>
    </h:body>
</html>

